home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(load){
- function updateRack(numberPress, sweetType)
- {
- _root.jake.gotoAndStop("j_refill");
- _root.sounds.gotoAndPlay("j_refill");
- trace("Sweet Rack: " + _root.rackControl.sweetRack);
- trace("current sweet: " + _root.currentSweet);
- trace("numberPressed: " + numberPress);
- trace("sweetType: " + sweetType);
- trace("Stored sweet type: " + _root.rackControl.sweetRack[numberPress - 1][0]);
- trace("=======================");
- if(_root.rackControl.sweetRack[numberPress - 1][0] == sweetType)
- {
- _root.interfaceControl.updateScoreText(_root.cashFillCorrect);
- _root.rackMoney.gotoAndPlay("rack_correct");
- _root.rackControl.sweetRack[numberPress - 1][1] = 0;
- eval("_root.area_" + numberPress).level.gotoAndStop(1);
- _root.interfaceControl.updateSpeechBubble(10);
- }
- else
- {
- _root.interfaceControl.updateScoreText(_root.cashFillWrong);
- _root.rackMoney.gotoAndPlay("rack_wrong");
- _root.interfaceControl.updateSpeechBubble(10);
- }
- _root.currentSweet = -1;
- }
- function serveTill()
- {
- _root.jake.gotoAndStop("j_action");
- _root.sounds.gotoAndPlay("j_till");
- _root.interfaceControl.updateScoreText(_root.childControl.childBagValue);
- _root.customer.gotoAndPlay("k" + _root.childControl.childType + "_hide");
- switch(_root.childControl.childBagValue)
- {
- case 500:
- _root.tillMoney.gotoAndPlay("type_4");
- break;
- case 375:
- _root.tillMoney.gotoAndPlay("type_3");
- break;
- case 250:
- _root.tillMoney.gotoAndPlay("type_2");
- break;
- case 125:
- _root.tillMoney.gotoAndPlay("type_1");
- }
- _root.childControl.childAtTill = false;
- _root.childControl.childBagValue = 0;
- _root.childControl.childType = 0;
- }
- function dispenseSweet()
- {
- lstAreas = new Array();
- areas = 0;
- while(areas < 9)
- {
- temp = _root.rackControl.sweetRack[areas][1];
- if(temp > 0)
- {
- lstAreas.push({arrayNum:areas,fillValue:temp});
- }
- areas++;
- }
- lstAreas = lstAreas.sortOn("fillValue",Array.NUMERIC);
- lstAreas = lstAreas.reverse();
- if(lstAreas.length < 4)
- {
- rndMax = lstAreas.length;
- }
- else
- {
- rndMax = 4;
- }
- if(lstAreas.length >= 1)
- {
- rndDrop = Math.floor(Math.random() * rndMax);
- _root.currentSweet = _root.rackControl.sweetRack[lstAreas[rndDrop].arrayNum][0];
- _root.jake.gotoAndPlay("j_action");
- _root.sounds.gotoAndPlay("j_dispenser");
- _root.dispenser.gotoAndPlay("sweet_" + _root.rackControl.sweetRack[lstAreas[rndDrop].arrayNum][0]);
- _root.interfaceControl.updateSpeechBubble(_root.rackControl.sweetRack[lstAreas[rndDrop].arrayNum][0]);
- }
- }
- jakeSpeed = 20;
- walking = false;
- action = "";
- actionFilled = false;
- actionServed = false;
- actionCollected = false;
- }
-